﻿using System;
using System.Web.UI.WebControls;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain;
using Ue.Qcdz.Domain.Permissions;
using Ue.Qcdz.Domain.Roles;

namespace Ue.Qcdz.UI.Controls.Roles
{
    public class RolesGridView : SkinnedGridView
    {
        private string sinkName = "~/Admin/Themes/Skins/Roles/Roles.ascx";
        public string Name { get; set; }
        public RolesGridView()
        {
            Name = SiteContext.GetSiteContext().Name;
        }

        protected override string GetSkinFileName()
        {
            return sinkName;
        }

        protected override void GridViewDataBind(object sender, EventArgs args)
        {
            //IDataResult<Role> dataResult = RoleService.GetRoles(this);
            //Repeater repeater = sender as Repeater;
            //repeater.DataSource = dataResult.DataObjects;
            //repeater.DataBind();
            //this.RecordCount = dataResult.RecordCount;
            Repeater repeater = sender as Repeater;
            repeater.DataSource = RoleService.GetRoles();
            repeater.DataBind();
        }
    }
}
